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 Feb 4, 2023
1 parent 643b3c1 commit 605164e
Show file tree
Hide file tree
Showing 8 changed files with 16,173 additions and 10,820 deletions.
1 change: 1 addition & 0 deletions dev/.files/bin/updater/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export default async ({ projDir }) => {
'./.shellcheckrc',
'./.stylelintrc.cjs',
'./.tailwindrc.cjs',
'./jest.config.mjs',
'./tsconfig.json',
'./vite.config.mjs',
'./wrangler.toml',
Expand Down
35 changes: 35 additions & 0 deletions dev/.files/jest/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env node
/**
* Jest config.
*
* @note PLEASE DO NOT EDIT THIS FILE!
* @note This entire file will be updated automatically.
* @note Instead of editing here, please review <https://github.com/clevercanyon/skeleton>.
*/
/* eslint-env es2021, node */

import fs from 'node:fs';
import path from 'node:path';
import { dirname } from 'desm';

const __dirname = dirname(import.meta.url);
const projDir = path.resolve(__dirname, '../../..');

/**
* Defines Jest configuration.
*/
export default async (/* {} */) => {
const srcDir = path.resolve(projDir, './src');
const srcDirExists = fs.existsSync(srcDir);

const testsDir = path.resolve(projDir, './tests');
const testsDirExists = fs.existsSync(testsDir);

return {
roots: [
...(srcDirExists ? [srcDir] : []), //
...(testsDirExists ? [testsDir] : []),
...(!srcDirExists && !testsDirExists ? [projDir] : []),
],
};
};
2 changes: 2 additions & 0 deletions dev/.files/madrun/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default async (/* {cmd, args, ctx} */) => {
'dev': async ({ args }) => 'npx vite dev' + (args.mode ? '' : ' --mode=dev') + ' {{@}}',
'preview': async ({ args }) => 'npx vite preview' + (args.mode ? '' : ' --mode=dev') + ' {{@}}',
'build': async ({ args }) => 'npx vite build' + (args.mode ? '' : ' --mode=prod') + ' {{@}}',

'jest': 'npx jest {{@}}', // Runs project Jest tests.
'wrangler': 'CLOUDFLARE_API_TOKEN="${USER_CLOUDFLARE_TOKEN:-}" npx wrangler {{@}}',

...events, // e.g., `on::madrun:default:new`.
Expand Down
28 changes: 14 additions & 14 deletions dev/.files/madrun/includes/events.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ export default {
homepage: 'https://github.com/' + $url.encode(parentDirOwner) + '/' + $url.encode(dirBasename) + '#readme',
bugs: 'https://github.com/' + $url.encode(parentDirOwner) + '/' + $url.encode(dirBasename) + '/issues',

$ꓺunset: /* Effectively resets these to default values. */ [
$unset: /* Effectively resets these to default values. */ [
'private', //
'publishConfigꓺaccess',
'publishConfig.access',

'version',
'license',
Expand All @@ -81,16 +81,16 @@ export default {
'author',
'contributors',

'configꓺc10nꓺ&ꓺgithubꓺteams',
'configꓺc10nꓺ&ꓺgithubꓺlabels',
'configꓺc10nꓺ&ꓺgithubꓺconfigVersion',
'configꓺc10nꓺ&ꓺgithubꓺenvsVersion',
'config.c10n.&.github.teams',
'config.c10n.&.github.labels',
'config.c10n.&.github.configVersion',
'config.c10n.&.github.envsVersion',

'configꓺc10nꓺ&ꓺnpmjsꓺteams',
'configꓺc10nꓺ&ꓺnpmjsꓺconfigVersions',
'config.c10n.&.npmjs.teams',
'config.c10n.&.npmjs.configVersions',
],
...(args.pkg ? { $ꓺset: { private: false } } : {}),
...(args.pkg && args.public ? { $ꓺset: { publishConfigꓺaccess: 'public' } } : {}),
...(args.pkg ? { $set: { private: false } } : {}),
...(args.pkg && args.public ? { $set: { 'publishConfig.access': 'public' } } : {}),
});

/**
Expand Down Expand Up @@ -129,17 +129,17 @@ export default {

if ('clevercanyon' === parentDirOwner) {
if (process.env.GH_TOKEN && 'owner' === (await u.gistGetC10NUser()).github?.role) {
await u.spawn('gh', ['repo', 'create', parentDirOwner + '/' + dirBasename, '--source=.', args.public ? '--public' : '--private'], { stdio: 'inherit' });
await u.spawn('gh', ['repo', 'create', parentDirOwner + '/' + dirBasename, '--source=.', args.public ? '--public' : '--private']);
} else {
const origin = 'https://github.com/' + $url.encode(parentDirOwner) + '/' + $url.encode(dirBasename) + '.git';
await u.spawn('git', ['remote', 'add', 'origin', origin], { stdio: 'inherit' });
await u.spawn('git', ['remote', 'add', 'origin', origin]);
}
} else if (process.env.USER_GITHUB_USERNAME === parentDirOwner) {
if (process.env.GH_TOKEN) {
await u.spawn('gh', ['repo', 'create', parentDirOwner + '/' + dirBasename, '--source=.', args.public ? '--public' : '--private'], { stdio: 'inherit' });
await u.spawn('gh', ['repo', 'create', parentDirOwner + '/' + dirBasename, '--source=.', args.public ? '--public' : '--private']);
} else {
const origin = 'https://github.com/' + $url.encode(parentDirOwner) + '/' + $url.encode(dirBasename) + '.git';
await u.spawn('git', ['remote', 'add', 'origin', origin], { stdio: 'inherit' });
await u.spawn('git', ['remote', 'add', 'origin', origin]);
}
}

Expand Down
23 changes: 23 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Jest config file.
*
* Jest is aware of this config file's location.
*
* @note CUSTOM EDITS ONLY PLEASE!
* @note In the future this file will be updated automatically.
* @note Only `<custom:start.../custom:end>` will be preserved below.
*/
/* eslint-env es2021, node */

import { $obj } from '@clevercanyon/utilities';
import baseConfig from './dev/.files/jest/config.mjs';

/*
* Customizations.
* <custom:start> */

export default async (jest) => {
return $obj.mc.merge({}, await baseConfig(jest), {});
};

/* </custom:end> */
Loading

0 comments on commit 605164e

Please sign in to comment.