imdone-core 2.0.9 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ npm run pre-commit
2
+
3
+ if ! git diff --quiet; then
4
+ echo "❌ Commit blocked: Files were modified. Please stage and commit again."
5
+ exit 1
6
+ fi
7
+ echo "✅ Commit allowed: No files were modified."
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.0.10
2
+ - Use static `get pluginName()` method to get the plugin name
3
+
4
+ ## 2.0.0
5
+ - Refactor to esm
6
+
1
7
  ## 1.28.8
2
8
  - Allow Card and Board actions to return a value
3
9
 
@@ -7,6 +7,7 @@ import { Config } from '../../config.js'
7
7
  import { logger } from '../logger.js'
8
8
 
9
9
  const { CONFIG_DIR, CONFIG_FILE_YML } = constants
10
+
10
11
  export async function load(projectPath, configPath = _path.join(projectPath, CONFIG_FILE_YML)) {
11
12
  const configLike = await loadYamlConfig(configPath)
12
13
  return configLike && new Config(configLike)
@@ -7,6 +7,10 @@ export default class ArchivePlugin extends Plugin {
7
7
  super(project)
8
8
  }
9
9
 
10
+ static get pluginName() {
11
+ return 'ArchivePlugin'
12
+ }
13
+
10
14
  get config() {
11
15
  return this.project.config
12
16
  }
@@ -5,6 +5,10 @@ export default class DefaultBoardActionsPlugin extends Plugin {
5
5
  super(project)
6
6
  }
7
7
 
8
+ static get pluginName() {
9
+ return 'DefaultBoardActionsPlugin'
10
+ }
11
+
8
12
  getBoardActions() {
9
13
  const project = this.project
10
14
  const isWindows = process.platform === 'win32'
@@ -19,6 +19,10 @@ export default class DefaultBoardPropertiesPlugin extends Plugin {
19
19
  this.templates = {}
20
20
  }
21
21
 
22
+ static get pluginName() {
23
+ return 'DefaultBoardPropertiesPlugin'
24
+ }
25
+
22
26
  async onBeforeBoardUpdate() {
23
27
  this.templates = await this.getTemplates()
24
28
  }
@@ -15,6 +15,10 @@ export default class EpicPlugin extends Plugin {
15
15
  this.epics = {}
16
16
  }
17
17
 
18
+ static get pluginName() {
19
+ return 'EpicPlugin'
20
+ }
21
+
18
22
  async onBeforeBoardUpdate() {
19
23
  this.epics = {}
20
24
  }
@@ -13,6 +13,10 @@ export default class ExtensionPlugin extends Plugin {
13
13
  this.configDir = _path.join(project.path, '.imdone')
14
14
  }
15
15
 
16
+ static get pluginName() {
17
+ return 'ExtensionPlugin'
18
+ }
19
+
16
20
  async init() {
17
21
  this.cardActionsFunction = await this.loadExtensionModule(
18
22
  () => [],
@@ -7,6 +7,10 @@ export default class PersistTagsPlugin extends Plugin {
7
7
  super(project)
8
8
  }
9
9
 
10
+ static get pluginName() {
11
+ return 'PersistTagsPlugin'
12
+ }
13
+
10
14
  async onBoardUpdate() {
11
15
  await save(this.project.allTags.sort(), this.project.path)
12
16
  }
@@ -184,9 +184,9 @@ export class PluginManager extends Emitter {
184
184
  }
185
185
 
186
186
  async createPlugin(pluginClass, path = undefined) {
187
- if (!this.isPlugin(pluginClass))
187
+ const name = pluginClass.pluginName
188
+ if (!name || !this.isPlugin(pluginClass))
188
189
  throw new Error(`${pluginClass.name} is not a plugin`)
189
- const name = pluginClass.name.toString()
190
190
  const pluginInstance = new pluginClass(this.project)
191
191
  const packageInfo = await this.getPackageInfo(path)
192
192
  let info = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "imdone-core",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,15 +14,18 @@
14
14
  },
15
15
  "scripts": {
16
16
  "prepublishOnly": "npm run build",
17
- "build": "npm run build:docs && npm run build:docs:index && npm run coverage && npm run build:index && npm run build:types",
17
+ "build": "npm run pre-commit && npm run coverage",
18
18
  "build:docs": "doctoc --github --notitle README.md",
19
19
  "build:docs:index": "node scripts/index-markdown.js",
20
20
  "build:index": "node scripts/generate-index.js",
21
21
  "build:types": "tsc --noEmit false",
22
22
  "coverage": "vitest --run --coverage",
23
+ "link": "npm link ../imdone-api",
24
+ "pre-commit": "npm run build:docs && npm run build:docs:index && npm run build:index && npm run build:types",
23
25
  "test": "vitest --run",
24
26
  "test-ci": "vitest --run",
25
- "serve": "npx docsify-cli serve"
27
+ "serve": "npx docsify-cli serve",
28
+ "prepare": "husky"
26
29
  },
27
30
  "keywords": [
28
31
  "imdone",
@@ -55,7 +58,7 @@
55
58
  "find-up-simple": "^1.0.1",
56
59
  "gray-matter": "^4.0.2",
57
60
  "ignore": "^5.2.0",
58
- "imdone-api": "^2.0.0",
61
+ "imdone-api": "^2.0.1",
59
62
  "isbinaryfile": "^5.0.4",
60
63
  "js-yaml": "^3.14.1",
61
64
  "json-fns": "^1.0.0",
@@ -107,6 +110,7 @@
107
110
  "esbuild": "^0.25.1",
108
111
  "expect.js": "~0.3.1",
109
112
  "fs-extra": "^11.1.0",
113
+ "husky": "^9.1.7",
110
114
  "json-stringify-safe": "~5.0.0",
111
115
  "prettier": "^2.5.1",
112
116
  "typescript": "^5.8.2",
@@ -1,4 +1,5 @@
1
1
  export default class ArchivePlugin {
2
+ static get pluginName(): string;
2
3
  constructor(project: any);
3
4
  get config(): any;
4
5
  get fileGateway(): any;
@@ -1,4 +1,5 @@
1
1
  export default class DefaultBoardActionsPlugin {
2
+ static get pluginName(): string;
2
3
  constructor(project: any);
3
4
  getBoardActions(): {
4
5
  title: string;
@@ -1,4 +1,5 @@
1
1
  export default class DefaultBoardPropertiesPlugin {
2
+ static get pluginName(): string;
2
3
  constructor(project: any);
3
4
  templates: {};
4
5
  onBeforeBoardUpdate(): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  export default class EpicPlugin {
2
+ static get pluginName(): string;
2
3
  constructor(project: any);
3
4
  epics: {};
4
5
  onBeforeBoardUpdate(): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  export default class ExtensionPlugin {
2
+ static get pluginName(): string;
2
3
  constructor(project: any);
3
4
  configDir: string;
4
5
  init(): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  export default class PersistTagsPlugin {
2
+ static get pluginName(): string;
2
3
  constructor(project: any);
3
4
  onBoardUpdate(): Promise<void>;
4
5
  }