Skip to content

Commit

Permalink
Merge pull request #91 from bigbite/release/1.3
Browse files Browse the repository at this point in the history
Release 1.3.0
  • Loading branch information
ampersarnie authored Jan 26, 2024
2 parents 794c966 + 327835c commit 24b6cf3
Show file tree
Hide file tree
Showing 33 changed files with 6,060 additions and 17,391 deletions.
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

0 comments on commit 24b6cf3

Please sign in to comment.