generated from wechaty/puppet-mock
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from wechaty/esm
ESM support
- Loading branch information
Showing
22 changed files
with
183 additions
and
99 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
SRC_PACKAGE_JSON_TS_FILE='src/package-json.ts' | ||
|
||
[ -f ${SRC_PACKAGE_JSON_TS_FILE} ] || { | ||
echo ${SRC_PACKAGE_JSON_TS_FILE}" not found" | ||
exit 1 | ||
} | ||
|
||
cat <<_SRC_ > ${SRC_PACKAGE_JSON_TS_FILE} | ||
/** | ||
* This file was auto generated from scripts/generate-version.sh | ||
*/ | ||
import type { PackageJson } from 'type-fest' | ||
export const packageJson: PackageJson = $(cat package.json) as any | ||
_SRC_ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
import { | ||
FileBox, | ||
} from 'wechaty-puppet' | ||
export const CHATIE_OFFICIAL_ACCOUNT_QRCODE = 'http://weixin.qq.com/r/qymXj7DEO_1ErfTs93y5' | ||
import { packageJson } from './package-json.js' | ||
|
||
export function qrCodeForChatie (): FileBox { | ||
const VERSION = packageJson.version || '0.0.0' | ||
|
||
const CHATIE_OFFICIAL_ACCOUNT_QRCODE = 'http://weixin.qq.com/r/qymXj7DEO_1ErfTs93y5' | ||
|
||
function qrCodeForChatie (): FileBox { | ||
return FileBox.fromQRCode(CHATIE_OFFICIAL_ACCOUNT_QRCODE) | ||
} | ||
|
||
export const MEMORY_SLOT = 'PUPPET_WHATSAPP' | ||
const MEMORY_SLOT = 'PUPPET_WHATSAPP' | ||
|
||
export { | ||
CHATIE_OFFICIAL_ACCOUNT_QRCODE, | ||
FileBox, | ||
MEMORY_SLOT, | ||
qrCodeForChatie, | ||
VERSION, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env node --no-warnings --loader ts-node/esm | ||
|
||
import { test } from 'tstest' | ||
|
||
import { packageJson } from './package-json.js' | ||
|
||
test('Make sure the packageJson is fresh in source code', async t => { | ||
const keyNum = Object.keys(packageJson).length | ||
t.equal(keyNum, 0, 'packageJson should be empty in source code, only updated before publish to NPM') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* This file will be overwrite when we publish NPM module | ||
* by scripts/generate_version.ts | ||
*/ | ||
import type { PackageJson } from 'type-fest' | ||
|
||
/** | ||
* Huan(202108): | ||
* The below default values is only for unit testing | ||
*/ | ||
export const packageJson: PackageJson = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.