diff --git a/.eslintrc.js b/.eslintrc.js index a4789523e..382028bdd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,18 +11,18 @@ module.exports = { }, overrides: [ { - 'files': ['**/fixtures/**'], - 'rules': { + files: ['**/fixtures/**'], + rules: { 'no-console': 'off', 'import/extensions': 'off', 'import/no-unresolved': 'off' } }, { - 'files': ['**/test/**'], - 'rules': { + files: ['**/test/**'], + rules: { 'import/extensions': 'off' } } - ], + ] }; diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 4b66eeddc..f04d208f5 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities diff --git a/.github/labels.json b/.github/labels.json index 35006bd35..13910163b 100644 --- a/.github/labels.json +++ b/.github/labels.json @@ -1,54 +1,54 @@ [ - { "name": "💩 template incomplete", "color": "#4E342E" }, - { "name": "💩 template removed", "color": "#4E342E" }, - - { "name": "b¹ 🐞 code-splitting", "color": "#F44336" }, - { "name": "b² 🐞 scope-hoisting", "color": "#F44336" }, - { "name": "b³ 🐞 tree-shaking", "color": "#F44336" }, - - { "name": "c¹ ⋅ discussion", "color": "#1976D2" }, - { "name": "c² ⋅ feedback wanted", "color": "#F9A825" }, - { "name": "c³ ⋅ PR welcome", "color": "#1B5E20" }, - { "name": "c⁴ ⋅ need more info", "color": "#6A1B9A" }, - { "name": "c⁵ ⋅ question", "color": "#C2185B" }, - { "name": "c⁶ ⋅ request for comments", "color": "#BBDEFB" }, - - { "name": "p¹ ⋅ browser", "color": "#B2DFDB" }, - { "name": "p² ⋅ linux", "color": "#B2DFDB" }, - { "name": "p³ ⋅ mac", "color": "#B2DFDB" }, - { "name": "p⁴ ⋅ windows", "color": "#B2DFDB" }, - - { "name": "pr¹ 🔧 chore", "color": "#D7CCC8" }, - { "name": "pr² 🔧 docs", "color": "#D7CCC8" }, - { "name": "pr³ 🔧 feature", "color": "#D7CCC8" }, - { "name": "pr⁴ 🔧 fix", "color": "#D7CCC8" }, - { "name": "pr⁵ 🔧 performance", "color": "#D7CCC8" }, - { "name": "pr⁶ 🔧 refactor", "color": "#D7CCC8" }, - { "name": "pr⁷ 🔧 style", "color": "#D7CCC8" }, - { "name": "pr⁸ 🔧 test", "color": "#D7CCC8" }, - - { "name": "s¹ 🔥🔥🔥 critical", "color": "#E53935" }, - { "name": "s² 🔥🔥 important", "color": "#FB8C00" }, - { "name": "s³ 🔥 nice to have", "color": "#FDD835" }, - { "name": "s⁴ 💧 low", "color": "#039BE5" }, - { "name": "s⁵ 💧💧 inconvenient", "color": "#c0e0f7" }, - - { "name": "t¹ 🐞 bug", "color": "#F44336" }, - { "name": "t² 📚 documentation", "color": "#FDD835" }, - { "name": "t³ ✨ enhancement", "color": "#03a9f4" }, - { "name": "t⁴ ⋅ regression", "color": "#0052cc" }, - { "name": "t⁵ ⋅ todo", "color": "#311B92" }, - { "name": "t⁶ ⋅ waiting on upstream", "color": "#0D47A1" }, - - { "name": "v¹ ⋅ major", "color": "#CDDC39" }, - { "name": "v² ⋅ minor", "color": "#FF9800" }, - { "name": "v³ ⋅ minor (experimental)", "color": "#FFC107" }, - - { "name": "x¹ ⋅ abandoned", "color": "#CFD8DC" }, - { "name": "x² ⋅ could not reproduce", "color": "#CFD8DC" }, - { "name": "x³ ⋅ duplicate", "color": "#CFD8DC" }, - { "name": "x⁴ ⋅ hold", "color": "#CFD8DC" }, - { "name": "x⁵ ⋅ in progress", "color": "#4CAF50" }, - { "name": "x⁶ ⋅ invalid", "color": "#CFD8DC" }, - { "name": "x⁷ ⋅ wontfix", "color": "#CFD8DC" } + { "name": "💩 template incomplete", "color": "#4E342E" }, + { "name": "💩 template removed", "color": "#4E342E" }, + + { "name": "b¹ 🐞 code-splitting", "color": "#F44336" }, + { "name": "b² 🐞 scope-hoisting", "color": "#F44336" }, + { "name": "b³ 🐞 tree-shaking", "color": "#F44336" }, + + { "name": "c¹ ⋅ discussion", "color": "#1976D2" }, + { "name": "c² ⋅ feedback wanted", "color": "#F9A825" }, + { "name": "c³ ⋅ PR welcome", "color": "#1B5E20" }, + { "name": "c⁴ ⋅ need more info", "color": "#6A1B9A" }, + { "name": "c⁵ ⋅ question", "color": "#C2185B" }, + { "name": "c⁶ ⋅ request for comments", "color": "#BBDEFB" }, + + { "name": "p¹ ⋅ browser", "color": "#B2DFDB" }, + { "name": "p² ⋅ linux", "color": "#B2DFDB" }, + { "name": "p³ ⋅ mac", "color": "#B2DFDB" }, + { "name": "p⁴ ⋅ windows", "color": "#B2DFDB" }, + + { "name": "pr¹ 🔧 chore", "color": "#D7CCC8" }, + { "name": "pr² 🔧 docs", "color": "#D7CCC8" }, + { "name": "pr³ 🔧 feature", "color": "#D7CCC8" }, + { "name": "pr⁴ 🔧 fix", "color": "#D7CCC8" }, + { "name": "pr⁵ 🔧 performance", "color": "#D7CCC8" }, + { "name": "pr⁶ 🔧 refactor", "color": "#D7CCC8" }, + { "name": "pr⁷ 🔧 style", "color": "#D7CCC8" }, + { "name": "pr⁸ 🔧 test", "color": "#D7CCC8" }, + + { "name": "s¹ 🔥🔥🔥 critical", "color": "#E53935" }, + { "name": "s² 🔥🔥 important", "color": "#FB8C00" }, + { "name": "s³ 🔥 nice to have", "color": "#FDD835" }, + { "name": "s⁴ 💧 low", "color": "#039BE5" }, + { "name": "s⁵ 💧💧 inconvenient", "color": "#c0e0f7" }, + + { "name": "t¹ 🐞 bug", "color": "#F44336" }, + { "name": "t² 📚 documentation", "color": "#FDD835" }, + { "name": "t³ ✨ enhancement", "color": "#03a9f4" }, + { "name": "t⁴ ⋅ regression", "color": "#0052cc" }, + { "name": "t⁵ ⋅ todo", "color": "#311B92" }, + { "name": "t⁶ ⋅ waiting on upstream", "color": "#0D47A1" }, + + { "name": "v¹ ⋅ major", "color": "#CDDC39" }, + { "name": "v² ⋅ minor", "color": "#FF9800" }, + { "name": "v³ ⋅ minor (experimental)", "color": "#FFC107" }, + + { "name": "x¹ ⋅ abandoned", "color": "#CFD8DC" }, + { "name": "x² ⋅ could not reproduce", "color": "#CFD8DC" }, + { "name": "x³ ⋅ duplicate", "color": "#CFD8DC" }, + { "name": "x⁴ ⋅ hold", "color": "#CFD8DC" }, + { "name": "x⁵ ⋅ in progress", "color": "#4CAF50" }, + { "name": "x⁶ ⋅ invalid", "color": "#CFD8DC" }, + { "name": "x⁷ ⋅ wontfix", "color": "#CFD8DC" } ] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c10e85000..758a819ee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,6 +50,9 @@ jobs: - name: pnpm install run: pnpm install + - name: Prettier + run: pnpm run prettier:check + - name: Build Packages run: pnpm build --recursive diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 6c8a00004..878e6563c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -42,6 +42,9 @@ jobs: - name: pnpm install run: pnpm install + - name: Prettier + run: pnpm run prettier:check + # pnpm audit isn't as robust as it needs to be atm # - name: Audit Dependencies # run: pnpm security diff --git a/.prettierignore b/.prettierignore index 90f49d8d0..49c3fcbbb 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,6 @@ .github/PULL_REQUEST_TEMPLATE.md packages/json/test/fixtures/garbage/* packages/yaml/test/fixtures/**/* -**/dist +**/dist/ +**/fixtures/ +pnpm-lock.yaml diff --git a/.vscode/launch.json b/.vscode/launch.json index 6f554c9d2..6a7f88a54 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,22 +1,16 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Mocha Tests", - "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", - "args": [ - "-u", - "tdd", - "--timeout", - "999999", - "--colors" - ], - "console": "integratedTerminal" - } - ] -} \ No newline at end of file + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Mocha Tests", + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": ["-u", "tdd", "--timeout", "999999", "--colors"], + "console": "integratedTerminal" + } + ] +} diff --git a/codecov.yml b/codecov.yml index c26c3bd80..f1b170aee 100644 --- a/codecov.yml +++ b/codecov.yml @@ -5,6 +5,6 @@ coverage: round: down range: 70...100 status: - project: "no" - patch: "yes" -comment: "off" + project: 'no' + patch: 'yes' +comment: 'off' diff --git a/package.json b/package.json index a5155a266..1b2e66d33 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,14 @@ "scripts": { "ci:coverage:submit": "node scripts/codecov", "lint": "pnpm lint:docs && pnpm --no-bail lint:json && pnpm lint:package && pnpm lint:js", - "lint:docs": "prettier --write .github/**/*.md **/README.md", + "lint:docs": "prettier --write .github/**/*.md **/README.md **/CHANGELOG.md", "lint:js": "eslint --cache packages scripts shared util --ext .js,.ts", "lint:json": "prettier --write .github/**/*.yml **/tsconfig.json tsconfig.*.json pnpm-workspace.yaml", - "lint:package": "prettier --write **/package.json --plugin=prettier-plugin-package", + "lint:package": "prettier --write **/package.json", "plugin:release": "ts-node ./scripts/release.ts", "preinstall": "node scripts/disallow-npm.js", + "prettier": "prettier --write .", + "prettier:check": "prettier --check .", "security": "pnpm audit --audit-level=high" }, "devDependencies": { @@ -61,11 +63,8 @@ "*.{ts,js}": [ "eslint --fix" ], - "*.md": [ - "prettier --single-quote --write" - ], - "*package.json": [ - "prettier --write --plugin=prettier-plugin-package" + "*.{ts,js,json,yaml,yml,md}": [ + "prettier --write" ] }, "nyc": { diff --git a/packages/dynamic-import-vars/CHANGELOG.md b/packages/dynamic-import-vars/CHANGELOG.md index f8e17bf3b..219d28569 100644 --- a/packages/dynamic-import-vars/CHANGELOG.md +++ b/packages/dynamic-import-vars/CHANGELOG.md @@ -69,4 +69,4 @@ _2020-08-13_ _2020-07-06_ -- First release \ No newline at end of file +- First release diff --git a/packages/html/recipes/external-files/ReadMe.md b/packages/html/recipes/external-files/ReadMe.md index 27f58b911..f35665078 100644 --- a/packages/html/recipes/external-files/ReadMe.md +++ b/packages/html/recipes/external-files/ReadMe.md @@ -7,55 +7,58 @@ import html from '@rollup/plugin-html'; import templateExternalFiles from '@rollup/plugin-html/recipes/external-files'; import postcss from 'rollup-plugin-postcss'; -export default [{ - input: [ 'demo/demo.ts' ], - output: [ { file: 'dist/demo.js' } ], - plugins: [ - postcss({ - extract: 'demo.css', - minimize: false, - use: ['sass'], - extensions: ['.scss', '.css'], - }), - html({ - title: 'sdk demo page', - publicPath: './', - fileName: 'demo.html', - attributes: { html: {lang: 'zh-cn'} }, - template: templateExternalFiles([ - { type: 'js', file: 'example1.js', pos: 'before' }, - { type: 'js', file: 'example2.js', pos: 'before' }, - { type: 'js', file: 'example3.js' }, - { type: 'js', file: 'example4.js', pos: 'before' }, - { type: 'css', file: 'example1.css', pos: 'before' }, - { type: 'css', file: 'example2.css', pos: 'before' }, - { type: 'css', file: 'example3.css' }, - { type: 'css', file: 'example4.css', pos: 'before' }, - ]), - }), - ], -}]; +export default [ + { + input: ['demo/demo.ts'], + output: [{ file: 'dist/demo.js' }], + plugins: [ + postcss({ + extract: 'demo.css', + minimize: false, + use: ['sass'], + extensions: ['.scss', '.css'] + }), + html({ + title: 'sdk demo page', + publicPath: './', + fileName: 'demo.html', + attributes: { html: { lang: 'zh-cn' } }, + template: templateExternalFiles([ + { type: 'js', file: 'example1.js', pos: 'before' }, + { type: 'js', file: 'example2.js', pos: 'before' }, + { type: 'js', file: 'example3.js' }, + { type: 'js', file: 'example4.js', pos: 'before' }, + { type: 'css', file: 'example1.css', pos: 'before' }, + { type: 'css', file: 'example2.css', pos: 'before' }, + { type: 'css', file: 'example3.css' }, + { type: 'css', file: 'example4.css', pos: 'before' } + ]) + }) + ] + } +]; ``` The content of the generated html file: + ```html - + - + sdk demo page - - - - - - - - - - - - + + + + + + + + + + + + ``` diff --git a/packages/replace/test/.eslintrc b/packages/replace/test/.eslintrc index a3e52829d..d5ba8f9d9 100644 --- a/packages/replace/test/.eslintrc +++ b/packages/replace/test/.eslintrc @@ -1,5 +1,5 @@ { - rules: { + "rules": { "no-console": "off" } } diff --git a/scripts/release.ts b/scripts/release.ts index ece0271cb..40c8c843e 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -126,6 +126,8 @@ const pull = async (main: string) => { await execa('git', ['checkout', '.npmrc']); await execa('git', ['pull', 'origin', main, '--no-edit']); + const { stdout } = await execa('git', ['status']); + console.log({ stdout }); await execa('git', ['rebase']); };