Skip to content

Commit

Permalink
chore(script): easy to debug theme
Browse files Browse the repository at this point in the history
  • Loading branch information
ourai committed Apr 11, 2024
1 parent 4475672 commit ecf40bf
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 34 deletions.
3 changes: 1 addition & 2 deletions .knosys/scripts/clean.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { resolve: resolvePath } = require('path');
const { resolveRootPath, rm } = require('@knosys/sdk');

const { resolveSiteSrcDir } = require('./helper');
const { resolveRootPath, rm, resolveSiteSrcDir } = require('./helper');

const patterns = [
'/.cache/',
Expand Down
5 changes: 1 addition & 4 deletions .knosys/scripts/copy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const { resolveRootPath, ensureDirExists, copyFileDeeply } = require('@knosys/sdk');
const { execute } = require('ksio');

const { getNopThemeDirPath } = require('./helper');
const { resolveRootPath, ensureDirExists, copyFileDeeply, execute, getNopThemeDirPath } = require('./helper');

module.exports = {
execute: site => {
Expand Down
3 changes: 1 addition & 2 deletions .knosys/scripts/gen/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { resolve: resolvePath } = require('path');
const { readData } = require('@knosys/sdk');

const { generateProjectDocs } = require('../helper');
const { readData, generateProjectDocs } = require('../helper');

module.exports = {
execute: (site = 'default', sourceKey) => generateProjectDocs(site, {
Expand Down
8 changes: 4 additions & 4 deletions .knosys/scripts/helper/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const { resolve: resolvePath } = require('path');
const { resolveRootPath } = require('@knosys/sdk');

const utils = require('./nop-project');
const ksUtils = require('./knosys');
const nopUtils = require('./nop-project');

function getNopThemeDirPath() {
return resolvePath(resolveRootPath(), utils.resolveSiteSrcDir('default'), 'themes/nop-project');
return resolvePath(ksUtils.resolveRootPath(), nopUtils.resolveSiteSrcDir('default'), 'themes/nop-project');
}

module.exports = { ...utils, getNopThemeDirPath };
module.exports = { ...ksUtils, ...nopUtils, getNopThemeDirPath };
1 change: 1 addition & 0 deletions .knosys/scripts/helper/knosys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { ...require('@knosys/sdk'), ...require('ksio') };
3 changes: 3 additions & 0 deletions .knosys/scripts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require('./helper').execute();
4 changes: 1 addition & 3 deletions .knosys/scripts/release.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const { execSync } = require('child_process');
const { pick } = require('@ntks/toolbox');
const { resolveRootPath, ensureDirExists, copyFileDeeply, cp, saveData } = require('@knosys/sdk');
const { execute } = require('ksio');

const { getNopThemeDirPath } = require('./helper');
const { resolveRootPath, ensureDirExists, copyFileDeeply, cp, saveData, execute, getNopThemeDirPath } = require('./helper');

const pkgName = '@nop-community/hexo-theme-site';

Expand Down
4 changes: 1 addition & 3 deletions .knosys/scripts/serve.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const { resolve: resolvePath } = require('path');
const { pick } = require('@ntks/toolbox');
const { resolveRootPath, getConfig, readData, saveData } = require('@knosys/sdk');
const { execute } = require('ksio');

const { resolveSiteSrcDir } = require('./helper');
const { resolveRootPath, getConfig, readData, saveData, execute, resolveSiteSrcDir } = require('./helper');

module.exports = {
execute: (site = 'default') => {
Expand Down
45 changes: 36 additions & 9 deletions package-lock.json

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

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@nop/website",
"version": "0.0.2",
"version": "0.0.3",
"description": "Official website",
"private": true,
"main": "index.js",
"scripts": {
"copy": "ksio copy",
"build": "ksio gen",
"clean": "ksio clean",
"start": "ksio serve",
"release": "ksio release"
"copy": "node .knosys/scripts copy",
"build": "node .knosys/scripts gen",
"clean": "node .knosys/scripts clean",
"start": "node .knosys/scripts serve",
"release": "node .knosys/scripts release"
},
"author": "Ourai L. <[email protected]>",
"license": "MIT",
Expand All @@ -32,6 +32,6 @@
"devDependencies": {
"@ntks/toolbox": "0.0.6",
"hexo-theme-lime": "0.0.0-alpha.1",
"ksio": "0.0.0"
"ksio": "0.0.1"
}
}

0 comments on commit ecf40bf

Please sign in to comment.