gettext-universal 1.0.2 → 1.0.3

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,9 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ time: "01:00"
8
+ timezone: Europe/Berlin
9
+ open-pull-requests-limit: 99
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import Scanner from "../src/scanner.mjs"
3
+ import Scanner from "../src/scanner.js"
4
4
 
5
5
  const processArgs = process.argv.slice(2)
6
6
  const extensions = []
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import Po2Mjs from "../src/po2mjs.mjs"
3
+ import Po2Mjs from "../src/po2mjs.js"
4
4
 
5
5
  const processArgs = process.argv.slice(2)
6
6
  let directory
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "bin": {
3
- "gettext-universal": "bin/gettext-universal.mjs"
3
+ "gettext-universal": "bin/gettext-universal.js"
4
4
  },
5
5
  "name": "gettext-universal",
6
- "version": "1.0.2",
6
+ "type": "module",
7
+ "version": "1.0.3",
7
8
  "main": "index.js",
8
9
  "scripts": {
9
- "gettext-universal": "node bin/gettext-universal.mjs",
10
- "po2mjs": "node bin/po2mjs.mjs",
11
- "test": "echo \"Error: no test specified\" && exit 1"
10
+ "gettext-universal": "node bin/gettext-universal.js",
11
+ "po2mjs": "node bin/po2mjs.js",
12
+ "test": "jasmine"
12
13
  },
13
14
  "repository": {
14
15
  "type": "git",
@@ -31,5 +32,8 @@
31
32
  },
32
33
  "peerDependencies": {
33
34
  "expo-localization": "*"
35
+ },
36
+ "devDependencies": {
37
+ "jasmine": "^5.7.1"
34
38
  }
35
39
  }
package/peak_flow.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  before_script:
2
2
  - npm install
3
3
  script:
4
- - echo "We should really implement some tests :-)"
4
+ - npm test
@@ -0,0 +1,9 @@
1
+ import translate from "../src/translate.js"
2
+
3
+ describe("gettext-universal", () => {
4
+ it("falls back to the given msgId", () => {
5
+ const result = translate("Hello world")
6
+
7
+ expect(result).toEqual("Hello world")
8
+ })
9
+ })
@@ -0,0 +1,14 @@
1
+ export default {
2
+ spec_dir: "spec",
3
+ spec_files: [
4
+ "**/*[sS]pec.js"
5
+ ],
6
+ helpers: [
7
+ "helpers/**/*.js"
8
+ ],
9
+ env: {
10
+ stopSpecOnExpectationFailure: false,
11
+ random: true,
12
+ forbidDuplicateNames: true
13
+ }
14
+ }
@@ -5,7 +5,7 @@ class Config {
5
5
 
6
6
  loadTranslationsFromRequireContext(requireContext) {
7
7
  for (const localeFile of requireContext.keys()) {
8
- const match = localeFile.match(/^\.\/([a-z]{2}).mjs$/)
8
+ const match = localeFile.match(/^\.\/([a-z]{2}).js$/)
9
9
 
10
10
  if (!match) {
11
11
  throw new Error(`Couldn't detect locale from file: ${localeFile}`)
@@ -21,7 +21,7 @@ export default class Po2Mjs {
21
21
  async readFile(file, ext) {
22
22
  const fullPath = `${this.directory}/${file}`
23
23
  const baseName = path.basename(file, ext)
24
- const jsFilePath = `${this.directory}/${baseName}.mjs`
24
+ const jsFilePath = `${this.directory}/${baseName}.js`
25
25
  const fileContentBuffer = await fs.readFile(fullPath)
26
26
  const fileContent = fileContentBuffer.toString()
27
27
  const matches = fileContent.matchAll(/#: (.+?)\nmsgid \"(.+?)\"\nmsgstr \"(.+?)\"\n(\n|$)/g)
@@ -1,4 +1,4 @@
1
- import config from "./config.mjs"
1
+ import config from "./config.js"
2
2
 
3
3
  const translate = (msgId, preferredLocales) => {
4
4
  if (!preferredLocales) {
@@ -1,4 +1,4 @@
1
- import translate from "./translate.mjs"
1
+ import translate from "./translate.js"
2
2
  import {useCallback} from "react"
3
3
  import {useLocales} from "expo-localization"
4
4
 
File without changes