Skip to content

Commit

Permalink
internal: Use yarn pnp
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Jul 26, 2022
1 parent 43a0a79 commit b9f23aa
Show file tree
Hide file tree
Showing 30 changed files with 850 additions and 103 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- run: yarn workspaces foreach run test:ci
- run: yarn workspaces foreach -v run test:ci
# only run coverage if repo token is available (so third parties don't fail the build)
- run:
name: coverage
Expand All @@ -66,7 +66,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- run: yarn workspaces foreach --include 'example-*' run build
- run: yarn workspaces foreach -v --include 'example-*' run build

build_server:
docker: *docker
Expand Down
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
13 changes: 9 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

{
"eslint.nodePath": "node_modules",
"eslint.nodePath": ".yarn/sdks",
"eslint.runtime": "node",
"typescript.format.enable": true,
"typescript.validate.enable": true,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
Expand All @@ -23,5 +22,11 @@
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
"typescript.enablePromptUseWorkspaceTsdk": true
}
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
6 changes: 6 additions & 0 deletions .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "eslint",
"version": "8.19.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
}
5 changes: 5 additions & 0 deletions .yarn/sdks/integrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost!

integrations:
- vscode
20 changes: 20 additions & 0 deletions .yarn/sdks/prettier/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/index.js
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier/index.js your application uses
module.exports = absRequire(`prettier/index.js`);
6 changes: 6 additions & 0 deletions .yarn/sdks/prettier/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "prettier",
"version": "2.7.1-sdk",
"main": "./index.js",
"type": "commonjs"
}
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/bin/tsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/bin/tsc your application uses
module.exports = absRequire(`typescript/bin/tsc`);
20 changes: 20 additions & 0 deletions .yarn/sdks/typescript/bin/tsserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/bin/tsserver your application uses
module.exports = absRequire(`typescript/bin/tsserver`);
6 changes: 6 additions & 0 deletions .yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "typescript",
"version": "4.7.4-sdk",
"main": "./lib/typescript.js",
"type": "commonjs"
}
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ changesetIgnorePatterns:
- "**/__tests__/**"
- "**/*.md"

nodeLinker: node-modules
nodeLinker: pnp

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ module.exports = function (api) {
pureGetters: true,
},
// allows us to load .babelrc in addition to this
babelrcRoots: ['packages/*', 'examples/*'],
//babelrcRoots: ['packages/*', 'examples/*'],
};
};
9 changes: 8 additions & 1 deletion examples/concurrent/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
module.exports = {
presets: [['@anansi', { typing: 'typescript' }]],
presets: [['@anansi', { typing: 'typescript', loose: true }]],
assumptions: {
noDocumentAll: true,
noClassCalls: true,
constantReexports: true,
objectRestNoSymbols: true,
pureGetters: true,
},
};
5 changes: 4 additions & 1 deletion examples/concurrent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"eslint": "^8.20.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
Expand All @@ -45,11 +46,13 @@
"typescript": "^4.7.4",
"webpack": "5.74.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.9.3"
"webpack-dev-server": "4.9.3",
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"@anansi/core": "^0.14.8",
"@anansi/router": "^0.6.10",
"@ant-design/icons": "^4.7.0",
"@babel/runtime": "^7.17.2",
"@linaria/core": "3.0.0-beta.22",
"@linaria/react": "3.0.0-beta.22",
Expand Down
2 changes: 1 addition & 1 deletion examples/concurrent/src/routing/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteController } from '@pojo-router/core';
import { RouteController } from '@anansi/router';
import type { History } from 'history';

import NotFound from 'components/NotFound';
Expand Down
11 changes: 8 additions & 3 deletions examples/linaria/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module.exports = {
presets: [
['@anansi', { typing: 'typescript' }],
],
presets: [['@anansi', { typing: 'typescript', loose: true }]],
assumptions: {
noDocumentAll: true,
noClassCalls: true,
constantReexports: true,
objectRestNoSymbols: true,
pureGetters: true,
},
};
27 changes: 25 additions & 2 deletions examples/linaria/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,30 @@
"devDependencies": {
"@anansi/babel-preset": "^3.2.12",
"@anansi/browserslist-config": "^1.3.3",
"@anansi/eslint-plugin": "^0.14.2",
"@anansi/webpack-config": "^12.0.3",
"@babel/core": "^7.18.9",
"@types/babel__core": "^7",
"@types/classnames": "^2.2.9",
"@types/eslint": "^8",
"@types/prettier": "^2",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"babel-loader": "8.2.5",
"eslint": "^8.20.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^2.7.1",
"react-refresh": "0.14.0",
"serve": "14.0.1",
"webpack": "5.74.0"
"webpack": "5.74.0",
"webpack-dev-server": "^4.9.3",
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"@babel/plugin-transform-modules-commonjs": "7.18.6",
Expand All @@ -32,9 +49,15 @@
"@linaria/shaker": "3.0.0-beta.22",
"classnames": "^2.2.6",
"core-js": "3.24.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"redbox-react": "^1.6.0"
},
"browserslist": [
"extends @anansi/browserslist-config"
]
],
"peerDependencies": {
"@types/react": "^17.0.40 || ^18.0.0-0",
"@types/react-dom": "^17.0.40 || ^18.0.0-0"
}
}
9 changes: 8 additions & 1 deletion examples/typescript/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
module.exports = {
presets: [['@anansi', { typing: 'typescript' }]],
presets: [['@anansi', { typing: 'typescript', loose: true }]],
assumptions: {
noDocumentAll: true,
noClassCalls: true,
constantReexports: true,
objectRestNoSymbols: true,
pureGetters: true,
},
};
34 changes: 30 additions & 4 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,54 @@
"devDependencies": {
"@anansi/babel-preset": "^3.2.12",
"@anansi/browserslist-config": "^1.3.3",
"@anansi/eslint-plugin": "^0.14.2",
"@anansi/jest-preset": "^0.7.16",
"@anansi/webpack-config": "^12.0.3",
"@babel/core": "^7.18.9",
"@rest-hooks/test": "7.3.4",
"@storybook/addon-essentials": "6.5.9",
"@storybook/addon-links": "6.5.9",
"@storybook/addons": "6.5.9",
"@storybook/builder-webpack5": "6.5.9",
"@storybook/manager-webpack5": "6.5.9",
"@storybook/react": "6.5.9",
"@types/babel__core": "^7",
"@types/classnames": "^2.2.9",
"@types/eslint": "^8",
"@types/jest": "28.1.6",
"@types/lodash": "4.14.182",
"@types/parse-link-header": "2.0.0",
"@types/prettier": "^2",
"@types/prop-types": "^15",
"@types/react-router": "^5.1.18",
"@types/react-router-dom": "^5.3.3",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"eslint": "^8.20.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "28.1.3",
"jest-environment-jsdom": "^28.1.3",
"prettier": "^2.7.1",
"react-refresh": "0.14.0",
"react-test-renderer": "18.2.0",
"require-from-string": "^2.0.2",
"serve": "14.0.1",
"webpack": "5.74.0"
"typescript": "^4.7.4",
"webpack": "5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.3",
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"@babel/runtime": "^7.17.2",
"@ant-design/icons": "^4.7.0",
"@babel/runtime": "^7.18.9",
"@rest-hooks/core": "^3.2.8",
"@rest-hooks/endpoint": "^2.2.11",
"@rest-hooks/graphql": "0.1.9",
"@rest-hooks/rest": "5.0.5",
"@types/node": "17.0.45",
Expand All @@ -53,10 +76,13 @@
"antd": "4.21.7",
"classnames": "^2.2.6",
"core-js": "3.24.0",
"history": "^5.3.0",
"lodash": "^4.17.15",
"moment": "^2.29.4",
"parse-link-header": "^2.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^5.3.0",
"react-router-scroll-4": "^1.0.0-beta.2",
"redbox-react": "^1.6.0",
Expand Down
7 changes: 4 additions & 3 deletions examples/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@
"@standard-endpoint/github/*": ["github/*"]
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
//"rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": [
/*"typeRoots": [
"node_modules/@types",
"../../node_modules/@types",
"./src/typings"
] /* List of folders to include type definitions from. */,
] List of folders to include type definitions from. ,*/

"types": [
"jest",
"@anansi/webpack-config/types",
"node"
"node",
"./src/typings"
] /* Type declaration files to be included in compilation. */,
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
Expand Down
Loading

0 comments on commit b9f23aa

Please sign in to comment.