Skip to content

Commit

Permalink
Project update. [p][robotic]
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswrks committed Aug 15, 2023
1 parent 733c6c1 commit f15178e
Show file tree
Hide file tree
Showing 15 changed files with 7,060 additions and 4,510 deletions.
10 changes: 10 additions & 0 deletions dev/.files/bin/updater/data/package.json/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@

"configꓺc10nꓺ&ꓺbuildꓺappType": "cma",
"configꓺc10nꓺ&ꓺbuildꓺtargetEnv": "any",
"configꓺc10nꓺ&ꓺbuildꓺentryFiles": [],

"configꓺc10nꓺ&ꓺssrBuildꓺappType": "",
"configꓺc10nꓺ&ꓺssrBuildꓺtargetEnv": "",
"configꓺc10nꓺ&ꓺssrBuildꓺentryFiles": [],

"configꓺc10nꓺ&ꓺgithubꓺteams": {},
"configꓺc10nꓺ&ꓺgithubꓺlabels": {},
Expand Down Expand Up @@ -115,6 +120,11 @@

"configꓺc10nꓺ&ꓺbuildꓺappType",
"configꓺc10nꓺ&ꓺbuildꓺtargetEnv",
"configꓺc10nꓺ&ꓺbuildꓺentryDirs",

"configꓺc10nꓺ&ꓺssrBuildꓺappType",
"configꓺc10nꓺ&ꓺssrBuildꓺtargetEnv",
"configꓺc10nꓺ&ꓺssrBuildꓺentryDirs",

"configꓺc10nꓺ&ꓺgithubꓺteams",
"configꓺc10nꓺ&ꓺgithubꓺlabels",
Expand Down
8 changes: 2 additions & 6 deletions dev/.files/eslint/config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,14 @@ const baseConfig = {

plugins: [
'import', //
'react',
'react-hooks',
'jsx-a11y',
'prettier', // Must come last.
'prettier',
],
extends: [
'eslint:recommended', //
'plugin:import/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended', // Must come last.
'plugin:prettier/recommended',
],
ignorePatterns: [
'!**/.*', //
Expand Down
19 changes: 17 additions & 2 deletions dev/.files/madrun/includes/events.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import fsp from 'node:fs/promises';

import u from '../../bin/includes/utilities.mjs';
import { $fs } from '../../../../node_modules/@clevercanyon/utilities.node/dist/index.js';
import { $is, $fn, $url, $brand } from '../../../../node_modules/@clevercanyon/utilities/dist/index.js';
import { $is, $fn, $str, $url, $brand } from '../../../../node_modules/@clevercanyon/utilities/dist/index.js';

const __dirname = $fs.imuDirname(import.meta.url);
const projDir = path.resolve(__dirname, '../../../..');
Expand Down Expand Up @@ -93,6 +93,21 @@ export default {
...(args.pkg && args.public ? { $set: { 'publishConfig.access': 'public' } } : {}),
});

/**
* Updates `./.wrangler.toml` file in new project directory.
*/

const wranglerFile = path.resolve(projDir, './.wrangler.toml');

if (fs.existsSync(wranglerFile)) {
let wrangler = fs.readFileSync(wranglerFile).toString(); // toML.

wrangler = wrangler.replace(/^(name\s*=\s*")([^"]*)(")/gmu, '$1' + $str.kebabCase(path.basename(args.pkgName || dirBasename)) + '$3');
wrangler = wrangler.replace(/^(route\s*=\s*\{\s*pattern\s*=\s*")([^"]*)(")/gmu, '$1' + path.basename(args.pkgName || dirBasename) + '$3');

await fsp.writeFile(wranglerFile, wrangler); // Updates `./.wrangler.toml` file.
}

/**
* Updates `./README.md` file in new project directory.
*/
Expand All @@ -102,7 +117,7 @@ export default {
if (fs.existsSync(readmeFile)) {
let readme = fs.readFileSync(readmeFile).toString(); // Markdown.

readme = readme.replace(/@clevercanyon\/[^/?#\s]+/gu, args.pkgName || '@' + parentDirOwner + '/' + dirBasename);
readme = readme.replace(/^(#\s+)(@[^/?#\s]+\/[^/?#\s]+)/gmu, '$1' + (args.pkgName || '@' + parentDirOwner + '/' + dirBasename));
await fsp.writeFile(readmeFile, readme); // Updates `./README.md` file.
}

Expand Down
6 changes: 3 additions & 3 deletions dev/.files/stylelint/config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const baseConfig = {
],
rules: {
'indentation': 'tab',
'no-duplicate-selectors': false,
'selector-type-no-unknown': false,
'no-descending-specificity': false,
'no-duplicate-selectors': null,
'selector-type-no-unknown': null,
'no-descending-specificity': null,
'selector-class-pattern': '^[_-]?[a-z][a-z0-9]*(?:[_-]{1,2}[a-z0-9]+)*$',
'selector-id-pattern': '^[a-z][a-z0-9]*(?:[_-]{1,2}[a-z0-9]+)*$',
'at-rule-no-unknown': [true, { ignoreAtRules: ['tailwind', 'apply', 'variants', 'responsive', 'screen'] }],
Expand Down
16 changes: 15 additions & 1 deletion dev/.files/tailwind/config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ Example `index.scss` starter file contents:
@tailwind utilities;
-------------------------------------------------------------------------------------------------------------------- */

const fs = require('node:fs');
const path = require('node:path');
const projDir = path.resolve(__dirname, '../../..');
const contentExtns = ['md', 'xml', 'html', 'shtml', 'php', 'ejs', 'js', 'jsx', 'cjs', 'cjsx', 'node', 'mjs', 'mjsx', 'ts', 'tsx', 'cts', 'ctsx', 'mts', 'mtsx'];

/**
* Composition.
Expand All @@ -36,5 +38,17 @@ module.exports = {
serif: ['Georgia', 'serif'],
},
},
content: [path.resolve(projDir, './src/**/*.{md,xml,html,shtml,php,ejs,js,jsx,cjs,cjsx,node,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtsx}')],
content: [
path.resolve(projDir, './src/**/*.{' + contentExtns.join(',') + '}'),

// If this package is using `@clevercanyon/utilities` we can also scan preact files.
...(fs.existsSync(path.resolve(projDir, './node_modules/@clevercanyon/utilities/dist/preact'))
? [path.resolve(projDir, './node_modules/@clevercanyon/utilities/dist/preact/**/*.{' + contentExtns.join(',') + '}')]
: []),

// If this package is using `@clevercanyon/utilities` we can also scan EJS views.
...(fs.existsSync(path.resolve(projDir, './node_modules/@clevercanyon/utilities/dist/assets/ejs-views'))
? [path.resolve(projDir, './node_modules/@clevercanyon/utilities/dist/assets/ejs-views/**/*.{' + contentExtns.join(',') + '}')]
: []),
],
};
7 changes: 5 additions & 2 deletions dev/.files/typescript/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @see https://www.typescriptlang.org/tsconfig
* @see https://vitejs.dev/guide/features.html#typescript-compiler-options
*/

{
"include": [
"../../../src/**/*", //
Expand All @@ -24,7 +23,9 @@
"target": "es2021",
"lib": ["es2021"],
"types": ["vite/client"],

"jsx": "react-jsx",
"jsxImportSource": "preact",

"module": "node16",
"moduleResolution": "node16",
Expand All @@ -40,7 +41,9 @@

"paths": {
// Note: Use just a single array item for Vite/Jest compatibility.
"@:src/*": ["./*"] // Relative to `baseUrl`.
"@:src/*": ["./*"], // Relative to `baseUrl`.
"react": ["../node_modules/preact/compat"],
"react-dom": ["../node_modules/preact/compat"]
},
"declaration": true,
"declarationMap": false,
Expand Down
2 changes: 2 additions & 0 deletions dev/.files/typescript/includes/import-aliases.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ const srcDir = path.resolve(projDir, './src');
*/
export default {
'^@:src/(.+)$': path.resolve(srcDir, './$1'),
'^react$': path.resolve(projDir, './node_modules/preact/compat'),
'^react-dom$': path.resolve(projDir, './node_modules/preact/compat'),
};
Loading

0 comments on commit f15178e

Please sign in to comment.