[Autotag] Add autotag
This commit is contained in:
parent
c5b7c6b93c
commit
4bed56b913
|
@ -0,0 +1,12 @@
|
||||||
|
const basicIncludes = (bundleCode, code, display = (code[0].toUpperCase() + code.substring(1))) => {
|
||||||
|
if (bundleCode.includes(code)) return display;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (bundleCode) => { // Scans final bundle JS to try and auto-detect things, then adding tags
|
||||||
|
const tags = [
|
||||||
|
basicIncludes(bundleCode, 'react'),
|
||||||
|
basicIncludes(bundleCode, 'document', 'DOM'),
|
||||||
|
].filter((x) => x !== undefined);
|
||||||
|
|
||||||
|
return tags;
|
||||||
|
};
|
|
@ -1,4 +1,5 @@
|
||||||
import ModuleRepos from './modules/index.js';
|
import ModuleRepos from './modules/index.js';
|
||||||
|
import AutoTag from './autoTag.js';
|
||||||
|
|
||||||
import Parcel from 'parcel-bundler';
|
import Parcel from 'parcel-bundler';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -161,7 +162,7 @@ for (const parentRepo of ModuleRepos) {
|
||||||
|
|
||||||
version: manifest.version,
|
version: manifest.version,
|
||||||
|
|
||||||
tags: manifest.tags,
|
tags: manifest.tags.concat(AutoTag(jsCode)),
|
||||||
|
|
||||||
authors: manifest.authors,
|
authors: manifest.authors,
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ for (const parentRepo of ModuleRepos) {
|
||||||
|
|
||||||
// console.log(lastHash);
|
// console.log(lastHash);
|
||||||
|
|
||||||
if (lastHash !== commitHash) {
|
if (commitHash !== '' && lastHash !== commitHash) {
|
||||||
console.log('[Warning] Commit hash in modules does not match latest commit in repo');
|
console.log('[Warning] Commit hash in modules does not match latest commit in repo');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue