Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.3.0 #91

Merged
merged 52 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
7d9d757
feat: adjust project discovery to base around package.json first
g-elwell Mar 29, 2023
0b121fb
fix: adjust list mode project discovery to use dir name
g-elwell Apr 21, 2023
429dc4b
chore: version bump
ampersarnie May 22, 2023
0a244fa
Merge branch 'release/1.3' into feat/project-discovery
ampersarnie May 22, 2023
63f6029
Merge pull request #70 from bigbite/feat/project-discovery
ampersarnie May 22, 2023
c93522c
fix: init typescript support
ampersarnie Jun 30, 2023
4300440
chore: merge master and fix conflicts
ampersarnie Jul 18, 2023
f6909ff
chore: merge master and fix conflicts
ampersarnie Jul 18, 2023
e33d65f
fix: remove console.logs
ampersarnie Jul 21, 2023
e612755
feat: add further typescript dependencies
ampersarnie Jul 21, 2023
ef5e03e
feat: add typescript eslint configs
ampersarnie Jul 21, 2023
a6d72b9
fix: update config to ensure we can use fragments
ampersarnie Jul 21, 2023
0e2599b
fix: declare common image types
ampersarnie Jul 21, 2023
f69c4ab
fix: add ts file extensions
ampersarnie Jul 21, 2023
7e5a4ab
fix: ensure paths are correct + assign ts project
ampersarnie Jul 21, 2023
0764b86
fix: add include/exclude to ensure target correct
ampersarnie Jul 21, 2023
4c89808
fix: add additional loaders for ts files
ampersarnie Jul 21, 2023
c8a91d7
fix: add return type as example
ampersarnie Jul 21, 2023
829137e
fix: move image decs
ampersarnie Jul 21, 2023
47326a1
chore: merge main and fix conflicts
ampersarnie Jul 21, 2023
4215e0d
Merge branch 'release/1.3' of github.com:bigbite/build-tools into rel…
ampersarnie Jul 21, 2023
887cbcb
fix: allow for path specific config
ampersarnie Jul 21, 2023
29d466f
fix: allow for multiple configs by name
ampersarnie Jul 21, 2023
5fc9a43
fix: exclude tsconfig-source from ignore
ampersarnie Jul 21, 2023
4acd5e0
fix: remove defining file and opt for extension
ampersarnie Jul 21, 2023
acb303e
fix: define tsconfig package reference
ampersarnie Jul 21, 2023
8d76ea3
fix: replace missing package-lock file
ampersarnie Jul 21, 2023
6bdb058
chore: merge main and fix conflicts
ampersarnie Jul 25, 2023
461b3a8
chore: merge release/1.3 branch and fix conflicts
ampersarnie Jul 25, 2023
93ac645
Merge pull request #90 from bigbite/feature/typescript-support
ampersarnie Jul 30, 2023
f5f84c2
chore: version bump
ampersarnie Jul 30, 2023
ebb1746
fix: corrects path list parsing for eslint alias
ampersarnie Aug 19, 2023
61f15e9
fix: add ts eslint resolver for additional files
ampersarnie Aug 19, 2023
5cb9988
Merge pull request #95 from bigbite/hotfix/1.3.0/css-in-js-resolve
ampersarnie Aug 21, 2023
5781edd
chore: bump version
ampersarnie Aug 21, 2023
cf7935f
chore: merge main and fix conflicts
ampersarnie Aug 21, 2023
7e17860
chore: version bump
ampersarnie Aug 24, 2023
380c3c7
fix: adds include path to config for ts files
ampersarnie Aug 24, 2023
1a3a8b3
Merge pull request #98 from ampersarnie/hotfix/add-include-tsconfig
ampersarnie Aug 24, 2023
7ed0c65
chore: merge main and fix conflicts
ampersarnie Aug 24, 2023
ea458b8
fix: add tsx and dts files to includes
ampersarnie Jan 9, 2024
5db7ff2
chore: bump version
ampersarnie Jan 9, 2024
17ec21c
fix: trailing semi-colon
ampersarnie Jan 9, 2024
2eb2904
test: add ignore patterns for local testing/dev
ampersarnie Jan 10, 2024
a9eeb2d
chore: add eslint config to example plugin
ampersarnie Jan 10, 2024
9634433
fix: remove hardcoded default
ampersarnie Jan 10, 2024
59757fa
fix: move project config object to own file
ampersarnie Jan 10, 2024
32ec542
test: add scoped vars to test
ampersarnie Jan 10, 2024
b47c3e3
fix: change config to allow defaults or a set project config
ampersarnie Jan 10, 2024
69db250
chore: package update
ampersarnie Jan 10, 2024
cf27c20
Merge pull request #103 from bigbite/hotfix/eslint-testing-ts-resolver
ampersarnie Jan 26, 2024
327835c
chore: merge main and fix conflicts
ampersarnie Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.DS_Store
.yalc
yalc.lock
node_modules
example-site/**/dist
example-site/**/inc/asset-settings.php
30 changes: 28 additions & 2 deletions __tests__/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe('CLI Build Command', () => {
expect(process.stdout.write).toHaveBeenCalledWith(` * my-theme `);
});

it('fails to run specific projects mode if a project is not found', () => {
it('runs specific projects mode if some requested projects are not found', () => {
mockFs({
...requiredRealDirs,
plugins: {
Expand All @@ -194,12 +194,38 @@ describe('CLI Build Command', () => {

runCommand('build', '--once', 'my-plugin,my-theme');

expect(process.stdout.write).toHaveBeenCalledWith(`Error: Project my-theme does not exist.\n`);
expect(mockWebpack).toHaveBeenCalled();
expect(process.stdout.write).toHaveBeenCalledWith(
`\x1b[1mCompiling \x1b[4mlist\x1b[0m\x1b[1m of projects in development mode.\x1b[0m\n`,
);
expect(process.stdout.write).toHaveBeenCalledWith('Processing the following projects:\n');
expect(process.stdout.write).toHaveBeenCalledWith(`Error: Project my-theme does not exist.`);
expect(process.stdout.write).toHaveBeenCalledWith(` * my-plugin `);
});

it('fails to run specific projects mode if no requested projects can be found', () => {
mockFs({
...requiredRealDirs,
plugins: {
'my-plugin': {
'package.json': JSON.stringify({
name: 'my-plugin',
}),
src: {
entrypoints: {
'some-file.js': 'console.log("file content here");',
},
},
},
},
});

runCommand('build', '--once', 'my-client-plugin,my-theme');

expect(process.stdout.write).toHaveBeenCalledWith(
`\x1b[1mCompiling \x1b[4mlist\x1b[0m\x1b[1m of projects in development mode.\x1b[0m\n`,
);
expect(process.stdout.write).toHaveBeenCalledWith(`Error: No projects found\n`);
expect(process.exit).toHaveBeenCalledWith(1);
});
});
Expand Down
84 changes: 50 additions & 34 deletions configs/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,56 @@ module.exports = {
babelOptions: {
...babelConfig,
},
},
plugins: ['@babel', 'react', 'prettier', 'jsdoc'],
settings: {
'import/resolver': eslintResolver('src'),
},
rules: {
complexity: ['error', 10],
'prettier/prettier': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
env: {
browser: true,
es2021: true,
node: true,
},
extends: ['airbnb', 'prettier', 'plugin:@typescript-eslint/recommended'],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
babelOptions: {
...babelConfig,
},
],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/react-in-jsx-scope': 0,
'react/prop-types': 0,
'react/forbid-prop-types': 0,
'react/require-default-props': 0,
'arrow-parens': 2,
'jsdoc/require-jsdoc': [
'error',
{
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true,
},
},
plugins: ['@babel', 'react', 'prettier', 'jsdoc', 'import', '@typescript-eslint/eslint-plugin'],
settings: {
'import/resolver': eslintResolver(),
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
],
},
},
rules: {
complexity: ['error', 10],
'prettier/prettier': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'react/react-in-jsx-scope': 0,
'react/prop-types': 0,
'react/forbid-prop-types': 0,
'react/require-default-props': 0,
'arrow-parens': 2,
'jsdoc/require-jsdoc': [
'error',
{
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true,
},
},
],
},
}
};
32 changes: 32 additions & 0 deletions configs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": false,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"noUncheckedIndexedAccess": true,
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment",
"typeRoots": [
"./types"
]
},
"include": [
"./src/**/*.ts",
"./src/**/*.tsx",
"./src/**/*.d.ts",
"typescript/images.d.ts"
],
"exclude": ["node_modules"]
}
Empty file added configs/typescript/dummy.ts
Empty file.
13 changes: 13 additions & 0 deletions configs/typescript/images.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
declare module '*.png';
declare module '*.jpeg';
declare module '*.jpg';

declare module '*.svg' {
const content: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
export default content;
}

declare module '*.svg?url' {
const content: string;
export default content;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"name": "test-client-plugin"
"name": "@namespace/test-client-plugin"
}
3 changes: 3 additions & 0 deletions example-site/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"name": "test-project",
"eslintConfig": {
"extends": "./../configs/eslint"
},
"dependencies": {
"prop-types": "^15.8.1"
}
Expand Down
Loading